# -- coding: utf-8 -- 
# Name: linux_mima
import crypt

def testpass(cryptpass):
    salt = cryptpass[cryptpass.find("$"):cryptpass.find("$")]
    dictfile = open('dict.txt','r')
    for wor in dictfile.readlines():
        wor = wor.strip('\n')
        cryptword = crypt.crypt(wor,salt)
        if cryptword == cryptpass:
            print "found password is %s\n" % wor
            return
    print "password not found"
    return

def main():
    passfile = open('mima.txt')
    for  line in passfile.readlines():
        if ":" in line:
            user = line.split(":")[0]
            cryptpass = line.split(":")[1].strip(" ")
            print "cracking passwod for:" + user
            testpass(cryptpass)

main()